<!DOCTYPE html>
<html lang="en">
	<!--
        	作者：lijj
        	时间：2016-03-16
        	描述：查看班级信息，添加班级信息
        -->

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
		<title>我的课程</title>
		<link rel="stylesheet" href="__PUBLIC__/css/weui.min.css" />
		<link rel="stylesheet" /href="__PUBLIC__/css/example.css" />
		<script src="__PUBLIC__/js/zepto.min.js"></script>
		<script src="__PUBLIC__/js/jquery-weui.js"></script>
		<script src="__PUBLIC__/js/jquery.min.js"></script>
		<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
		<style type="text/css">
			.container{
				overflow: visible;
			}
			.hd{
				padding: 1em;
			}
			.weui_cells_title{
				padding-left: 15px;
			}
		</style>

	</head>

	<body>
		<!--添加班级 start hidden-->
		<div class="weui_msg" id="add" style="display: none;">
			<h1 class="page_title">添加班级</h1>
			<div class="weui_msg_addclass">
				<div class="weui_cells_title addclass_title">请填写班级信息</div>
				<div class="weui_cells weui_cells_form">
					<div class="weui_cell">
						<div class="weui_cell_hd">
							<label class="weui_label addclass_label">班级</label>
						</div>
						<div class="weui_cell_bd weui_cell_primary">
							<input class="weui_input" id="class" type="text" maxlength="11" placeholder="请输入班级(eg:网络1401班)" />
						</div>
					</div>
					<div class="weui_cell">
						<div class="weui_cell_hd">
							<label class="weui_label addclass_label">学院</label>
						</div>
						<div class="weui_cell_bd weui_cell_primary">
							<input class="weui_input" id="college" type="text" placeholder="请输入班级(eg:信息与电子工程学院)" />
						</div>
					</div>
					<div class="weui_cell">
						<div class="weui_cell_hd">
							<label class="weui_label addclass_label">学校</label>
						</div>
						<div class="weui_cell_bd weui_cell_primary">
							<input class="weui_input" id="school" type="text" value="浙江工商大学" />
						</div>
					</div>
					<div class="weui_cell">
						<div class="weui_cell_hd">
							<label class="weui_label addclass_label">学期</label>
						</div>
						<div class="weui_cell_bd weui_cell_primary">
							<select class="weui_select_apply" id="semester" spellcheck="false">
								<option value="" disabled="disabled" selected="selected">----</option>
								<option value="网络1401" selected="selected">2016年春季</option>
								<option value="网络1402">2016年秋季</option>
								<option value="网络1501">2017年春季</option>
								<option value="网络1501">2017年秋季</option>
							</select>
						</div>
					</div>
				</div>
				<div class="weui_cells_title addclass_title">请填写班级上课时间地点</div>
				<div class="weui_cells weui_cells_form">
					<div class="weui_cell">
						<div class="weui_cell_hd">
							<label class="weui_label addclass_label">时间</label>
						</div>
						<div class="weui_cell_bd weui_cell_primary">
							<input class="weui_input" id="time" value="1-16周 周四 3、4、5节" />
						</div>
					</div>
					<div class="weui_cell">
						<div class="weui_cell_hd">
							<label class="weui_label addclass_label">地点</label>
						</div>
						<div class="weui_cell_bd weui_cell_primary">
							<input class="weui_input" id="place" type="text" value="A324" />
						</div>
					</div>
				</div>
				<div class="weui_btn_area">
					<input class="weui_btn weui_btn_primary" id="addsucceed" type="button" value="添加" />
					<input class="weui_btn weui_btn_default" id="addcancel" type="button" value="取消" />
				</div>
			</div>
		</div>
		<!--添加班级end-->
		<!--查看班级start-->
		<div class="container" style="display: ;">
			<div class="hd">
				<h1 class="page_title">我的班级</h1>
				<div class="addclass">
					<a href="javascipt:;" class="weui_btn weui_btn_mini weui_btn_primary" id="addclass">添加班级</a>
				</div>
			</div>
			<div class="bd">
				<div class="classnav">浙江工商大学
					<div class="semester">
						<select id="semester">
							<option value="2015年秋季">2015年秋季</option>
							<option value="2016年春季">2016年春季</option>
							<option value="2016年秋季">2016年秋季</option>
							<option value="2017年春季">2017年春季</option>
						</select>
					</div>
				</div>

				<foreach name="teaClass" item="teaClass">
					<div class="classinfo">
						<div class="group">
							<div class="classinfo group classes">{$teaClass.class}</div>
							<div class="classinfo group college">{$teaClass.college}</div>
						</div>
						<br/>
						<label class="classinfo studentes"><span>73</span>人</label>
						<div class="happen">
							<label class="classinfo happen time" style="margin: 0; padding: 0;"><i class="weui_icon_info"></i>{$teaClass.schooltime}</label>
							<label class="classinfo happen place" style="margin-left: 0; padding-left: 0;"><i class="weui_icon_waiting"></i>{$teaClass.place}</label>
						</div>
					</div>
				</foreach>
			</div>
		</div>
		<div class="weui_msg" id="warminfo" style="display: none;">
			<div class="weui_icon_area do_success"><i class="weui_icon_success weui_icon_msg"></i></div>
			<div class="weui_icon_area do_failure" style="display: none;"><i class="weui_icon_warn weui_icon_msg"></i></div>
			<div class="weui_text_area">
				<h2 class="weui_msg_title do_success">操作成功</h2>
				<h2 class="weui_msg_title do_failure" style="display: none;">操作失败</h2>
				<p class="weui_msg_desc do_failure"></p>
				<p class="weui_msg_desc do_success" style="display: none;"></p>
			</div>
			<div class="weui_opr_area">
				<p class="weui_btn_area">
					<a href="javascript:;" href="" class="weui_btn weui_btn_primary" id="yes">确定</a>
				</p>
			</div>
			<div class="weui_extra_area">
				<a href="javascript:;">查看详情</a>
			</div>
		</div>

	</body>
	<script type="text/javascript">
		$("#addclass").click(function(e) {
			$("#add").show();
			$(".container").hide();
		});
		$("#addcancel").click(function(e) {
			$("#add").hide();
			$(".container").show();
		});
		$("#addsucceed").click(function(e) {
			//获得输入的变量
			var banji = $('#class').val();
			var colloge = $("#college").val();
			var school = $("#school").val();
			var semester = $("#semester").val();
			var schooltime = $("#time").val();
			var place = $("#place").val();
			//做一个简单的逻辑判断
			if (!banji || !colloge || !school || !semester) {
				alert("信息不能为空");
				return false;
			}
			//发送给数据库
			url = "{:U('Index/AddMyClass')}";
			data　 = {
				classes: banji,
				college: colloge,
				school: school,
				semester: semester,
				schooltime: schooltime,
				place: 　place,
			}
			$.post(url, data,
				function(data, states) {
					if(data.status){
						$(".weui_msg").hide();
						$("#warminfo").show();
					}
				});
		});
		$("#yes").click(function(e){
			wx.closeWindow();
		});
	</script>

</html>